object PrimesUpTo10000 {
  def main(args: Array[String]): Unit = {
    val primes = (2 to 10000).filter(isPrime)
    println(s"1-10000以内的质数个数：${primes.size}")
    println(primes.mkString(", "))
  }

  def isPrime(n: Int): Boolean = {
    if (n <= 1) false
    else (2 to math.sqrt(n).toInt).forall(n % _ != 0)
  }
}